const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const webpack = require('webpack')

module.exports = {
    mode: 'none',
    entry: './src/main.js',
    output: {
        path: path.join(__dirname, 'dist'),
        filename: 'js.bundle.[contenthash:6].js'
    },
    module:{
        rules: [
            {
                test: /\.css$/,
                use:['style-loader','css-loader']
            },
            {
                test: /\.vue$/,
                loader: 'vue-loader'
            },
            {
                test: /\.less$/,
                use: ['style-loader','css-loader','less-loader'] 

            },
            {
                test: /\.(png|gif|jpg)$/,
                use:{
                    loader:'url-loader',
                    options: {
                        limit: 4*1024,
                        esModule:false,
                        name:'img/[name].[contenthash:6].[ext]'
                    }
                }
            }

    ]
    },
    plugins: [
        new VueLoaderPlugin(),
        new HtmlWebpackPlugin({
            template: './public/index.html',
            title:'Vue App Sample'
        }),
      new webpack.DefinePlugin({
          BASE_URL: '"/"'
      })
    ]
}